<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid" style="margin-top:0;">
                <tr><td><?=translate('GENERAL_LANGUAGE_FILENAME')?></td><td><input type="text" name="id" value="<?= $id ?>" size="59" /></td><td></td></tr>
                <thead><tr><td><?=translate('GENERAL_LANGUAGE_ORIGINAL')?></td><td><?=translate('GENERAL_LANGUAGE_TRANSLATION')?></td><td width="25"><?=translate('DEL')?></td></tr></thead>
                <?php $i = 0; ?>
                <?php foreach ($row as $m => $n) { ?>
                    <tr rel="<?= $i ?>"><td><input type="text" name="row[<?= $i ?>][name]" size="30" value="<?= $m ?>" /></td><td><textarea name="row[<?= $i ?>][desc]" cols="58" rows="1"><?= $n ?></textarea></td><td><a href="javascript:;" class="deleteone"><?=translate('DEL')?></a></td></tr>
                    <?php $i++; ?>
                <?php } ?>
                <tr><td style="text-align: left;">&nbsp;&nbsp;<a href="javascript:;" id="appendone"><?=translate('APPEND')?></a></td>
                    <td colspan="2" style="text-align: left;"><?=translate('SYNC')?>：<?= $arealist ?></td>
                </tr>
                <tr><td></td><td colspan="2" style="text-align: left;"><input type="submit" value="<?=translate('SUBMIT')?>" id="submit"/> <input type="reset" value="<?=translate('RESET')?>" id="reset"/></td></tr>
            </table>
        </form>
        <script type="text/javascript">
            $(function() {
                $("#appendone").live("click", function() {
                    var i = parseInt($(this).parent().parent().prev().attr("rel"));
                    i = isNaN(i) ? -1 : i;
                    i++;
                    $('<tr rel="' + i + '"><td><input type="text" name="row[' + i + '][name]" size="30" value="" /></td><td><textarea name="row[' + i + '][desc]" cols="60" rows="1"></textarea></td><td><a href="javascript:;" class="deleteone"><?=translate('DEL')?></a></td></tr>').insertBefore($(this).parent().parent());
                });
                $(".deleteone").live("click", function() {
                    $(this).parent().parent().remove();
                });
            });
        </script>
    </body>
</html>